package org.locker.domain.bo;

import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.locker.common.core.validate.AddGroup;
import org.locker.common.core.validate.EditGroup;
import org.locker.common.mybatis.core.domain.BaseEntity;
import org.locker.domain.Order;

import java.math.BigDecimal;
import java.util.Date;

/**
 * 订单业务对象 lk_order
 *
 * @author winnie
 * @date 2023-10-11
 */
@Data
@EqualsAndHashCode(callSuper = true)
@AutoMapper(target = Order.class, reverseConvertGenerate = false)
public class OrderBo extends BaseEntity {

    /**
     * 订单ID
     */
    @NotNull(message = "订单ID不能为空", groups = {EditGroup.class})
    private Long orderId;

    /**
     * 用户ID
     */
    @NotNull(message = "用户ID不能为空", groups = {EditGroup.class})
    private Long userId;

    /**
     * 手机号码
     */
    @NotBlank(message = "手机号码不能为空", groups = {AddGroup.class, EditGroup.class})
    private String phone;

    /**
     * 设备号
     */
    @NotBlank(message = "设备号不能为空", groups = {AddGroup.class, EditGroup.class})
    private String deviceNo;

    /**
     * 设备号
     */
    private String deviceName;

    /**
     * 柜子好
     */
    private String deviceGridName;

    /**
     * 格子ID
     */
    @NotNull(message = "格子ID不能为空", groups = {AddGroup.class, EditGroup.class})
    private Long deviceGridId;

    /**
     * 开锁密码
     */
    @NotBlank(message = "开锁密码不能为空", groups = {AddGroup.class, EditGroup.class})
    private String openPwd;

    /**
     * 订单编号
     */
    @NotBlank(message = "订单编号不能为空", groups = {EditGroup.class})
    private String orderNo;

    /**
     * 场地ID
     */
    @NotNull(message = "场地ID不能为空", groups = {EditGroup.class})
    private Long positionId;

    /**
     * 微信交易流水号
     */
    @NotBlank(message = "微信交易流水号不能为空", groups = {EditGroup.class})
    private String transactionNo;

    /**
     * 自定义交易号
     */
    private String outTradeNo;

    /**
     * 实际支付金额(微信支付的)
     */
    @NotNull(message = "实际支付金额(微信支付的)不能为空", groups = {EditGroup.class})
    private BigDecimal payAmount;

    /**
     * 存柜预付金额
     */
    @NotNull(message = "存柜预付金额不能为空", groups = {EditGroup.class})
    private BigDecimal prestoreDeviceAmount;

    /**
     * 押金金额
     */
    @NotNull(message = "押金金额不能为空", groups = {EditGroup.class})
    private BigDecimal depositAmount;

    /**
     * 计费单价
     */
    private BigDecimal unitPrice;

    /**
     * 实际计算的设备存柜金额
     */
    @NotNull(message = "实际计算的设备存柜金额不能为空", groups = {EditGroup.class})
    private BigDecimal actualDeviceAmount;

    /**
     * 剩余的金额，交易完成需要存到用户余额。
     */
    @NotNull(message = "剩余的金额，交易完成需要存到用户余额。不能为空", groups = {EditGroup.class})
    private BigDecimal residueAmount;

    /**
     * 开始时间
     */
    @NotNull(message = "开始时间不能为空", groups = {EditGroup.class})
    private Date startTime;

    /**
     * 结束时间
     */
    @NotNull(message = "结束时间不能为空", groups = {EditGroup.class})
    private Date endTime;

    /**
     * 状态：create 创建订单 ,wait_notify 等待通知,pay_success 成功, fail 用户取消,交易失败() , in_used 使用中, used_done 使用完成
     */
    @NotBlank(message = "状态：create 创建订单 ,wait_notify 等待通知,pay_success 成功, fail 用户取消,交易失败() , in_used 使用中, used_done 使用完成不能为空", groups = {EditGroup.class})
    private String orderStatus;

    /**
     * 身份证号码
     */
    @NotBlank(message = "身份证号码不能为空", groups = {EditGroup.class})
    private String idNo;

    /**
     * 交易完成时间
     */
    @NotNull(message = "交易完成时间不能为空", groups = {EditGroup.class})
    private Date successTime;

    /**
     * 支付时间
     */
    @NotNull(message = "支付时间不能为空", groups = {EditGroup.class})
    private Date payTime;

    /**
     * 是否已经转余额：yes 是，no 否
     */
    @NotBlank(message = "是否已经转余额：yes 是，no 否不能为空", groups = {EditGroup.class})
    private String isToBalance;

    /**
     * offline 离线  online 在线
     */
    @NotBlank(message = "offline 离线  online 在线不能为空", groups = {EditGroup.class})
    private String isOffline;

    /**
     * 订单类型：times 按次, hour 按时,
     */
    @NotBlank(message = "订单类型：times 按次, hour 按时,不能为空", groups = {EditGroup.class})
    private String orderType;

    /**
     * 支付方式：余额支付：balance, 微信支付 wx_pay, 系统支付(零元/免单): system_pay
     */
    @NotBlank(message = "支付方式：余额支付：balance, 微信支付 wx_pay, 系统支付(零元/免单): system_pay不能为空", groups = {EditGroup.class})
    private String payWay;

    /**
     * 备注
     */
    @NotBlank(message = "备注不能为空", groups = {EditGroup.class})
    private String remark;


    /**
     * 退款状态：refund_no 押金未退，refunding 退款中，refund_success 退款成功
     */
    private String refundStatus;

    /**
     * 结算状态,不可结算:unsettleable, 可结算:settleable, 已结算:settled
     */
    private String settlementStatus;


    private boolean wxUser;


    /**
     * 分账状态：spilt_no 未分账，spilting 分账中，spilt_success 分账成功
     */
    private String paySpiltStatus;

}
